package jwf;

import java.util.Set;

import jwf.http.Http;
import jwf.http.Request;
import jwf.http.Response;

import com.fastcgi.FCGIInterface;

public class JWFMain {

    public static void main(String[] args) throws Exception {
	System.setProperty("FCGI_PORT", "4000");
	FCGIInterface fcgi = new FCGIInterface();
	while (fcgi.FCGIaccept() >= 0) {
//	    Response response = new Response(fcgi.request);
//	    Request request = new Request(fcgi.request);
//	    response.setHeader(Http.HH_CONTENT_TYPE,
//		    "text/html; charset=UTF-8\r\n");
//	    response.outputHeader();
	    // String ref = "|" + System.currentTimeMill s();
	    // Random random = new Random(System.currentTimeMillis());
	    // StringBuffer sb = new StringBuffer();
	    // for (int i = 0; i < random.nextInt(20); ++i) {
	    // sb.append(ref);
	    // }
	    // response.writeRaw(sb.toString());
	    // response.writeRaw("<br/>");
	    // Set<Object> keys = fcgi.request.params.keySet();
	    // for (Object key : keys) {
	    // response.writeRaw(key + ":"
	    // + fcgi.request.params.getProperty((String) key));
	    // response.writeRaw("<br/>");
	    // }
//	    response.writeRaw("");
	    System.out.println("Content-Type: text/html\r\n");
	    System.out.println("abc");
	}
    }
}
